$(function() {
	$("#add_goodsCategory_form").validate({
		errorPlacement:function(error,element) {  
			element.parent().find(".verror").html(error);
		},
		rules:{
			"goodsCategory.categoryName":{
				required:true,
				rangelength: [2, 20],
				remote: {
					url: base + "admin/goodsCategory/checkCategoryName.action", 
					type: "POST", 
					data: {"goodsCategory.id": ($("#goodsCategory.id").val()), "goodsCategory.categoryName": ($("#goodsCategory.categoryName").val())}
					}
				}
			},
		messages:{
			"goodsCategory.categoryName": {
				required: "请输入商品类别", 
				rangelength:"长度不能少于{0}和大于{1}个字符",
				remote: "该商品名称已经存在,请勿重复添加"
			}
		}
	});
});